package net.entelijan.cobean.examples.showcase.config.combobox;

import java.awt.Color;
import java.awt.Font;

import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.JTextField;

import net.entelijan.cobean.examples.util.ExamplesUtil;
import net.entelijan.scf.DefaultShowcasePanel;
import net.miginfocom.swing.MigLayout;

public class ConfigBookAuthorComboPanel extends DefaultShowcasePanel {

	private static final long serialVersionUID = 1L;

	private JTextField failureTextField;

	private JTextField titleTextField;

	private JTextField subtitleTextField;

	private JTextField yearTextField;

	private JTextField authorNameTextField;

	private JTextField authorBirthdayTextField;

	private JCheckBox translationCheckBox;
	
	private JComboBox authorLanguageComboBox;
	
	private JComboBox authorCountryComboBox;

	private JButton showModelButton = new JButton("Show Model");

	private JButton resetButton = new JButton("Reset");

	private JButton defaultValuesButton = new JButton("Default Values");

	public ConfigBookAuthorComboPanel() {
		super();
		failureTextField = createFailureTextField();
		
		titleTextField = createTextField();
		subtitleTextField = createTextField();
		yearTextField = createTextField();

		authorNameTextField = createTextField();
		authorBirthdayTextField = createTextField();
		
		translationCheckBox = createComboBox();
		
		authorLanguageComboBox = new JComboBox();
		authorCountryComboBox = new JComboBox();

		setLayout(new MigLayout());
		
		add(new JLabel(""), "w 100:100:100");
		
		add(failureTextField, "w max, wrap");
		
		add(new JSeparator(), "span 2, wrap, grow");
		add(new JLabel(""), "");
		add(createBoldLabel("Book"), "wrap");
		add(new JLabel("Title"), "");
		add(titleTextField, "w max, wrap");
		add(new JLabel("Subtitle"), "");
		add(subtitleTextField, "w max, wrap");
		add(new JLabel("Year"), "");
		add(yearTextField, "w max, wrap");
		add(new JLabel("Translation"), "");
		add(translationCheckBox, "w 10, h 10, wrap");
		
		add(new JSeparator(), "span 2, wrap, grow");
		add(new JLabel(""), "");
		add(createBoldLabel("Author"), "wrap");
		add(new JLabel("Name"), "");
		add(authorNameTextField, "w max, wrap");
		add(new JLabel("Birthday"), "");
		add(authorBirthdayTextField, "w max, wrap");
		add(new JLabel("Language"), "");
		add(authorLanguageComboBox, "w max, wrap");
		add(new JLabel("Country"), "");
		add(authorCountryComboBox, "w max, wrap");

		add(new JPanel(), "h max, w max, span 2, wrap");

		add(ExamplesUtil.createButtonsPanel(150, this.showModelButton,
				this.resetButton, this.defaultValuesButton), "span 2");

	}

	private JCheckBox createComboBox() {
		final JCheckBox re = new JCheckBox();
		re.setEnabled(false);
		return re;
	}

	private JTextField createTextField() {
		final JTextField re = new JTextField();
		re.setEnabled(false);
		return re;
	}

	private JLabel createBoldLabel(String text) {
		JLabel re = new JLabel(text);
		re.setFont(re.getFont().deriveFont(Font.BOLD));
		return re;
	}

	private JTextField createFailureTextField() {
		JTextField re = new JTextField();
		re.setBorder(null);
		re.setForeground(Color.RED);
		re.setEditable(false);
		return re;
	}

	public JTextField getFailureTextField() {
		return failureTextField;
	}

	public void setFailureTextField(JTextField failureTextField) {
		this.failureTextField = failureTextField;
	}

	public JTextField getTitleTextField() {
		return titleTextField;
	}

	public void setTitleTextField(JTextField titleTextField) {
		this.titleTextField = titleTextField;
	}

	public JTextField getSubtitleTextField() {
		return subtitleTextField;
	}

	public void setSubtitleTextField(JTextField subtitleTextField) {
		this.subtitleTextField = subtitleTextField;
	}

	public JTextField getYearTextField() {
		return yearTextField;
	}

	public void setYearTextField(JTextField yearTextField) {
		this.yearTextField = yearTextField;
	}

	public JButton getShowModelButton() {
		return showModelButton;
	}

	public void setShowModelButton(JButton showModelButton) {
		this.showModelButton = showModelButton;
	}

	public JButton getResetButton() {
		return resetButton;
	}

	public void setResetButton(JButton resetButton) {
		this.resetButton = resetButton;
	}

	public void setDefaultValuesButton(JButton defaultValuesButton) {
		this.defaultValuesButton = defaultValuesButton;
	}

	public JButton getDefaultValuesButton() {
		return defaultValuesButton;
	}

	public JTextField getAuthorNameTextField() {
		return authorNameTextField;
	}

	public void setAuthorNameTextField(JTextField authorNameTextField) {
		this.authorNameTextField = authorNameTextField;
	}

	public JTextField getAuthorBirthdayTextField() {
		return authorBirthdayTextField;
	}

	public void setAuthorBirthdayTextField(JTextField authorBirthdayTextField) {
		this.authorBirthdayTextField = authorBirthdayTextField;
	}

	public JCheckBox getTranslationCheckBox() {
		return translationCheckBox;
	}

	public void setTranslationCheckBox(JCheckBox translationCheckBox) {
		this.translationCheckBox = translationCheckBox;
	}

	public JComboBox getAuthorLanguageComboBox() {
		return authorLanguageComboBox;
	}

	public void setAuthorLanguageComboBox(JComboBox languageComboBox) {
		this.authorLanguageComboBox = languageComboBox;
	}

	public JComboBox getAuthorCountryComboBox() {
		return authorCountryComboBox;
	}

	public void setAuthorCountryComboBox(JComboBox countryComboBox) {
		this.authorCountryComboBox = countryComboBox;
	}

	
}
